package com.ccrfid.rmc6.entity.device;

import com.vividsolutions.jts.geom.Point;
import org.hibernate.annotations.CreationTimestamp;
import org.hibernate.annotations.Type;
import org.hibernate.annotations.UpdateTimestamp;

import javax.persistence.*;
import java.sql.Timestamp;

@Entity
@Table(name = "d_locator")
public class LocatorEntity {
    private Long id;
    private String sn;
    private Integer locatorType;
    private Integer locatorAddress;
    private Integer enabled;
    private Integer onlineStatus;
    private String remark;
    private Point pos;
    private Integer floorNumber;
    private Timestamp createTime;
    private Timestamp updateTime;

    @Id
    @Column(name = "id", nullable = false)
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    @Basic
    @Column(name = "sn", nullable = true, length = 32)
    public String getSn() {
        return sn;
    }

    public void setSn(String sn) {
        this.sn = sn;
    }

    @Basic
    @Column(name = "locator_type", nullable = false)
    public Integer getLocatorType() {
        return locatorType;
    }

    public void setLocatorType(Integer locatorType) {
        this.locatorType = locatorType;
    }

    @Basic
    @Column(name = "locator_address", nullable = false)
    public Integer getLocatorAddress() {
        return locatorAddress;
    }

    public void setLocatorAddress(Integer locatorAddress) {
        this.locatorAddress = locatorAddress;
    }

    @Basic
    @Column(name = "is_enabled", nullable = false)
    public Integer getEnabled() {
        return enabled;
    }

    public void setEnabled(Integer enabled) {
        this.enabled = enabled;
    }

    @Basic
    @Column(name = "online_status", nullable = true)
    public Integer getOnlineStatus() {
        return onlineStatus;
    }

    public void setOnlineStatus(Integer onlineStatus) {
        this.onlineStatus = onlineStatus;
    }

    @Basic
    @Column(name = "remark", nullable = true, length = 255)
    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }

    @Basic
    @Column(name = "pos")
    @Type(type = "jts_geometry")
    public Point getPos() {
        return pos;
    }

    public void setPos(Point pos) {
        this.pos = pos;
    }

    @Basic
    @Column(name = "floor_number", nullable = true)
    public Integer getFloorNumber() {
        return floorNumber;
    }

    public void setFloorNumber(Integer floorNumber) {
        this.floorNumber = floorNumber;
    }

    @Basic
    @Column(name = "create_time", nullable = false)
    @CreationTimestamp
    public Timestamp getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Timestamp createTime) {
        this.createTime = createTime;
    }

    @Basic
    @Column(name = "update_time", nullable = false)
    @UpdateTimestamp
    public Timestamp getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(Timestamp updateTime) {
        this.updateTime = updateTime;
    }

    @Override
    public String toString() {
        return "LocatorEntity{" +
                "id=" + id +
                ", sn='" + sn + '\'' +
                ", locatorType=" + locatorType +
                ", locatorAddress=" + locatorAddress +
                ", enabled=" + enabled +
                ", onlineStatus=" + onlineStatus +
                ", remark='" + remark + '\'' +
                ", pos=" + pos +
                ", floorNumber=" + floorNumber +
                ", createTime=" + createTime +
                ", updateTime=" + updateTime +
                '}';
    }
}
